﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Web.Mvc;

namespace InternshipManagement.Models
{
    [MetadataType(typeof(Student_Validation))]
    public partial class Student{
        public string Email
        {
            get { 
                return string.Concat(UserName,"@gmail.com");
            }
        }
        public string DisplayName
        {
            get
            {
                return string.Concat(Name," ",Surname);
            }
        }
        public string UserName
        {
            get;
            set;
        }
    }

    public class Student_Validation
    {
        [Required(ErrorMessage = "UserName is required")]
        [StringLength(100, ErrorMessage = "UserName may not be longer than 100 characters")]
        [DisplayName("User Name")]
        public string UserName { get; set; }
        [Required]
        [DisplayName("Student Number")]
        public int StudentNumber { get; set; }
        [Required(ErrorMessage = "Name is required")]
        [StringLength(45, ErrorMessage = "Name may not be longer than 45 characters")]
        public string Name { get; set; }
        [Required(ErrorMessage = "Surname is required")]
        [StringLength(45, ErrorMessage = "Surname may not be longer than 45 characters")]
        public string Surname { get; set; }
        
    }
}